/****************************************************
    文件：TriggerItemFader.cs
	作者：Jack
    日期：#CreateTime#
	功能：Nothing
*****************************************************/

using UnityEngine;

public class TriggerItemFader : MonoBehaviour 
{
    private void OnTriggerEnter2D(Collider2D other)
    {
      
        ItemFader[] faders=other.GetComponentsInChildren<ItemFader>();
        print(faders.Length);
        if(faders.Length > 0)
        {
            foreach(var item in faders)
            {
               
                item.FadeOut();
            }
        }
    }

    private void OnTriggerExit2D(Collider2D other)
    {
       

        ItemFader[] faders = other.GetComponentsInChildren<ItemFader>();
        if (faders.Length > 0)
        {
            foreach (var item in faders)
            {
               
                item.FadeIn();
            }
        }
    }
}